<?php
    include_once("../../service/commentService.php");
    include_once("../../service/userService.php");
    include_once("../../service/productService.php");
    include_once("../../service/categoryService.php");
    include_once("../../service/userService.php");
    
    $pro_id = $_GET["p"];
    $rootComments = getAllFirstCommentOfProduct($pro_id,1,null);
?>
<table class="table table-striped table-bordered bootstrap-datatable datatable">
		  <thead>
			  <tr>
                  <th>Người dùng</th>
				  <th>Ý kiến</th>
				  <th>Trạng thái</th>
                  <th>Ngày</th>                  
			  </tr>
		  </thead>   
		  <tbody>
                <?php
                    while($rootComment = mysql_fetch_array($rootComments)){
                ?>
				<tr>
					<td>
                        <?php
                            $user = findUserById($rootComment["USER_ID"]);
                            $userInfo = mysql_fetch_array($user);
                            echo $userInfo["USER_USERNAME"];
                        ?>
                    </td>
					<td>
                        <?php
                            echo $rootComment["COM_CONTENT"];
                        ?>
                    </td>
					<td>
                        <?php
                            echo $rootComment?"<input type='checkbox' value='".$rootComment["COM_ID"]."' checked/>":"<input type='checkbox' value=''/>";
                        ?>
                    </td>
                    <td>
                        <?php
                            echo $rootComment["COM_CREATIONDATE"];
                        ?>
                    </td>
				</tr>
                <?php                                        
                    }
                ?>									
		  </tbody>
	  </table>  
